import {Request,Response,NextFunction} from 'express'
import httpStatusCodes from 'http-status-codes';

import HttpException from '../models/httpException'

export default function(error: HttpException,_request:Request,_response:Response,_next:NextFunction){
    _response.status(error.status || httpStatusCodes.INTERNAL_SERVER_ERROR).send({
        success: false,
        message: error.message,
        errors: error.error ||""            
    })
}